package cn.zyjblogs.server.user.constant;


/**
 * @author zhuyijun
 */
public enum LoginEnum {
    /**
     * 账号号邮箱方式
     */
    NORMAL("1", "普通登录方式", "password"),
    /**
     * 验证码方式
     */
    VERIFY_CODE("2", "手机验证码方式", "smscode");


    private String code;
    private String name;

    private String grantType;

    public String getGrantType() {
        return grantType;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    LoginEnum(String code, String name, String grantType) {
        this.code = code;
        this.name = name;
        this.grantType = grantType;
    }

    public static String getGrantTypeByCode(String code) {
        LoginEnum[] values = LoginEnum.values();
        for (LoginEnum value : values) {
            if (value.code.equals(code)) {
                return value.grantType;
            }
        }
        return LoginEnum.NORMAL.grantType;
    }
}
